﻿using SAEA.RedisSocket.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KeydbCommand.Libs
{
    public static class KeydbCmdHelper
    {
        static IEnumerable<string> _list;
        static KeydbCmdHelper()
        {
            _list = Enum.GetNames(typeof(RequestType)).Select(b => b.Replace("_", " "));
        }

        public static IEnumerable<string> GetList(string input, int max = 10)
        {
            if (string.IsNullOrEmpty(input))

                return _list.OrderBy(b => b).Take(max);

            return _list.Where(b => b.IndexOf(input, StringComparison.InvariantCultureIgnoreCase) > -1).OrderBy(b => b).Take(max);
        }
    }
}
